package com.atguigu.gmalllogger.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.*;


/**
 * @Author:GaoFei
 * @Description:
 * @Date:Created in 18:11
 * @Modified By:
 */
@RestController
public class makeMessage {
    private  final Logger logger = LoggerFactory.getLogger(makeMessage.class);
    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;
    @RequestMapping("applog")
    public String sendMessage(@RequestParam(value = "param",defaultValue = "")  String jsonStr ){

        logger.info(jsonStr);
        // 写入 Kafka
        kafkaTemplate.send("ods_base_log", jsonStr);

        return "success";
    }
}
